//
// Created by 1065246 on 2023/5/5.
//
#include<iostream>
#include "Computer.h"

Computer::Computer(Cpu *mycpu, VideoCard *videoCard, Memory *memory){
    cpu=mycpu;
    video_card=videoCard;
    mem=memory;
}

Computer::~Computer() {
    if(cpu !=NULL){
        delete cpu;
        cpu=NULL;
    }
    if(video_card!=NULL){
        delete video_card;
        video_card=NULL;
    }
    if(mem!=NULL){
        delete mem;
        mem=NULL;
    }
}

void Computer::work() {
    std::cout<<"Computer start work"<<std::endl;
    cpu->calclate();
    mem->storage();
    video_card->display();
    std::cout<<"Computer end work"<<std::endl;
}